<template>
  <div>
    Echarts天气预报

    {{ weather }}
  </div>
</template>
<script>
export default {
  data() {
    return {
      weather: [],
    };
  },
  created() {
    //初始化清空时光轴 => 预防没有锚点页面
    this.$store._mutations.TSINGHUA_ID[0]({});
    //天气
    this.$axios({
      method: "get",
      url: "http://wthrcdn.etouch.cn/weather_mini?city=运城市",
    })
      .then((response) => {
        console.log(response.data.data);
        this.weather = response.data.data;
      })
      .catch(function (error) {
        console.log(error);
      });
  },
  mounted() {
    //生成id => 为锚点跳转做铺垫
    this.$store._actions.addElementId[0]();
  },
};
</script>



<style scoped>
</style>